package com.einox.chikko;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

public class Message {

	private String message;
	private Buddy buddy;
	private Date timestamp;
	
	public Message(String message, Buddy buddy){
		this.message = message.trim();
		this.buddy = buddy;
		
		timestamp = new Date();
	}
	
	public String getMessage(){
		return message;
	}
	
	public Buddy getBuddy(){
		return buddy;
	}
	
	public void setTimestamp(String chikkaTimestamp){
		try {
			SimpleDateFormat sdf = new SimpleDateFormat("yyMMddhhmmss");
			timestamp = sdf.parse(chikkaTimestamp);
		}
		catch(ParseException e){
			timestamp = new Date();
		}
		
	}
	
}
